package com.eaoa.utils;

import java.util.HashSet;
import java.util.Set;

public class IPAddressUtils {
	
	public static boolean isInnerIP(String clientIPAddress){
	     String[] ip = clientIPAddress.split("\\."); 
	     
	     Set innerIPs = new HashSet();
	     innerIPs.add("1722912");
	     innerIPs.add("1722913");
	     innerIPs.add("12700");
	     
	     StringBuffer ipbuffer = new StringBuffer("");
	     if (ip != null && ip.length == 4){
	    	 ipbuffer.append(ip[0]);
	    	 ipbuffer.append(ip[1]);
	    	 ipbuffer.append(ip[2]);
	    	 String ipstring = ipbuffer.toString();
	    	 if (innerIPs.contains(ipstring)){
	    		 return true;
	    	 }
	     }	     
	     return false;
	}
	
	public static boolean isInnerIP2(String clientIPAddress){
		String innerIP1 = "172.29";
		String innerIP2 = "127.0.0.1";
		String innerIP3 = "localhost";
		if(clientIPAddress.indexOf(innerIP1)!=-1
				|| clientIPAddress.indexOf(innerIP2)!=-1
				|| clientIPAddress.indexOf(innerIP3)!=-1
				){
			return true;
		}
	     return false;
	}
}
